<?php
/***/
namespace app\admin\controller;

/**
 * 删除缓存
 */
class Caches extends Father
{

	public function index()
	{
		return $this->fetch();
	}

	//清除缓存
	public function clear()
	{
		deleteCache();
		return json(['code' => 200, 'msg' => '清除缓存成功']);
	}

	//清除全部缓存
	public function clears()
	{
		$list = ['BLACK','CMPPMSG','GROUPCONFIG','CHANNEL','SIZE','TEMPLATE','CONFIG','OPERATOR','KEYWORD'];

		$success = 0;

		foreach ($list as $key => $value) {
			
			if (deleteCache($value) == '删除缓存成功') {

				$success++;
			}
		}

		return json(['code' => 200, 'msg' => '清除缓存成功，成功数：' . $success]);
	}

}
